<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div class="box">123</div>
  <div class="box">abc</div>
  <p id="nav">导航栏</p>
  <ul>
    <li>测试1</li>
    <li>测试2</li>
    <li>测试3</li>
  </ul>
  <script>
    const box = document.querySelectorAll('.box')
    console.dir(box)

    const nav = document.querySelector('#nav')
    console.dir(nav)
    nav.style.color = 'red'

    const li = document.querySelector('ul li:first-child')
    console.dir(li)

    const lis = document.querySelectorAll('ul li')//获取的是数组
    console.dir(lis)
  </script>
</body>

</html>